<template>
  <MkBillList ref='drawerRef'>
    <MkQueryContainer>
      <template #header="">
        <MkForm ref="queryForm" :model="searchParam" :inline="true">
          <MkInput label="关键字" @keyup.enter.native="search" v-model="searchParam.keyword" clearable="" />
          <el-form-item>
            <MkButtonQuery @click="search"> </MkButtonQuery>
          </el-form-item>
        </MkForm>
      </template>
      <MkTable :data="tableData" v-loading="loading" @row-dblclick="edit">
        <MkColumnIndex />
        <MkColumn prop="id" label="单据号" />
        <MkColumn prop="danJuLeiXing" label="单据类型" />
        <MkColumn prop="danJuZhuangTai" label="单据状态" />
        <MkColumn prop="laiYuanDanHao" label="来源单号" />
        <MkColumnBasEntity entity="XieYiYiYuan" prop="ruKuYuanQuId" label="入库院区" />
        <MkColumn prop="remark" label="备注" />
      </MkTable>
      <MkPagination v-model:page="searchParam.page" v-model:pageSize="searchParam.pageSize" :total="total"
        @query="search" />
    </MkQueryContainer>
  </MkBillList>
</template>

<script lang='ts' setup>
// 血液入库单
import { InvRuKuApi, InvRuKuOutput, InvRuKuPageInput } from '/@/api/inv/InvRuKu';
import { usePageQuery } from '/@/hooks/usePageQuery'
import { clog, showSuccess } from '/@/utils'

const drawerRef = ref();
const emits = defineEmits(['load'])
const { searchParam, total, tableData, loading, search } = usePageQuery<InvRuKuOutput, InvRuKuPageInput>(InvRuKuApi.page)
searchParam.danJuLeiXing = "协议医院入库";

onMounted(() => {
  nextTick(() => {
    search();
  })
})

const edit = (row: any) => {
  drawerRef.value?.close();
  emits('load', row)
}

const open = async () => {
  drawerRef.value.show();
};

defineExpose({ open })

</script>

<style lang='scss' scoped></style>